﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TM.Data;
using TM.Data.Contracts;
using TM.Data.ViewModels.VmMapper;
using TM.Plugable;

namespace ProjectHost
{
    public partial class AppointmentEditorScreen : Form, IProjectEditor
    {
        public AppointmentEditorScreen()
        {
            InitializeComponent();
            this.scheduleEditorControl1.Dock = DockStyle.Fill;
        }
        public event ProjectDataIsChangedHandler ProjectDataIsChanged;
        #region Implementation of IProjectEditor
        public bool IsDirty { get { return scheduleEditorControl1.IsDirty; } }

        public object Session { get { return scheduleEditorControl1.Session; } }
        public Guid ProjectId { get { return scheduleEditorControl1.ProjectId; } }

        public IVmMapper VmMapper
        {
            get
            {
                return scheduleEditorControl1.VmMapper;
            }
        }

        public IUnitOfWork UoW
        {
            get
            {
                return scheduleEditorControl1.UoW;
            }
        }

        public bool IsDataLoaded { get { return scheduleEditorControl1.IsDataLoaded; } }

        public void SetIoC(IIoCParams ioCParams, IVmMapper vmMapper)
        {
            scheduleEditorControl1.SetIoC(ioCParams, vmMapper);
        }

        public void LoadProjectInformation(Guid projectId)
        {
            scheduleEditorControl1.LoadProjectInformation(projectId);
        }

        public void RemoveCurrentTask()
        {
            scheduleEditorControl1.RemoveCurrentTask();
        }

        public void CreateNewTask()
        {
            scheduleEditorControl1.CreateNewTask();
        }

        public void Release()
        {
            scheduleEditorControl1.Release();
        }
        public void Save()
        {
            if (scheduleEditorControl1.IsDirty)
            {
                scheduleEditorControl1.Save();
            }
        }
        #endregion
    }
}
